﻿<UserControl x:Class="ScrumFactory.IterationPlanning.IterationPlanning"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             xmlns:props="clr-namespace:ScrumFactory.IterationPlanning.Properties"
             xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"                             
             xmlns:SF_Adorners="clr-namespace:ScrumFactory.Windows.Helpers.Adorners;assembly=ScrumFactory.Windows.Helpers"
             xmlns:converters="clr-namespace:ScrumFactory.IterationPlanning.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             
             
             x:Name="iterationView">
    
    <UserControl.Resources>

        <Style x:Key="SprintDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type CalendarDayButton}">

                        <!-- This is new -->
                        <ControlTemplate.Resources>
                            <converters:SprintCalendarDayConverter x:Key="SprintCalendarDayConverter" />
                        </ControlTemplate.Resources>

                        <Grid Margin="0,2,0,2">



                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0:0:0.1" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                            <DoubleAnimation Storyboard.TargetName="NormalText" Storyboard.TargetProperty="Opacity" To=".35" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Unselected" />
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="SelectedBackground" Storyboard.TargetProperty="Opacity" To=".75" Duration="0" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                           
                                <VisualStateGroup x:Name="ActiveStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Active" />
                                    <VisualState x:Name="Inactive">
                                        <Storyboard>
                                            <ColorAnimation Duration="0" Storyboard.TargetName="selectedText" Storyboard.TargetProperty="Color" To="#FF777777"></ColorAnimation>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="DayStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="RegularDay" />
                                    <VisualState x:Name="Today">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="TodayBackground" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                            <ColorAnimation Duration="0" Storyboard.TargetName="selectedText" Storyboard.TargetProperty="Color" To="#FFFFFFFF"></ColorAnimation>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="BlackoutDayStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="NormalDay" />
                                    <VisualState x:Name="BlackoutDay">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" Storyboard.TargetName="Blackout" Storyboard.TargetProperty="Opacity" To=".2"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Border
                                x:Name="InSprintDayBackground" IsHitTestVisible="False"
                                BorderThickness="0,1,0,1" BorderBrush="Orange"
                                Background="Yellow" Opacity="0.5"/>

                            <Rectangle x:Name="TodayBackground" RadiusX="5" RadiusY="5" Opacity="0" Fill="Red"/>

                            <Rectangle x:Name="SelectedBackground" RadiusX="1" RadiusY="1" Opacity="0" Fill="{TemplateBinding Background}"/>
                            <Rectangle x:Name="Background" RadiusX="1" RadiusY="1" Opacity="0" Fill="{TemplateBinding Background}"/>
                            <ContentPresenter
                                    x:Name="NormalText"                                
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"                                
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Margin="6,0,6,0">
                                <TextElement.Foreground>
                                    <SolidColorBrush x:Name="selectedText" Color="#FF333333"/>
                                </TextElement.Foreground>
                            </ContentPresenter>
                            <Path x:Name="Blackout" Opacity="0" Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" Fill="#FF000000" Stretch="Fill" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"/>
                            <Rectangle x:Name="DayButtonFocusVisual" Visibility="Collapsed" RadiusX="5" RadiusY="5" Fill="Yellow" Opacity="0.5" Cursor="Hand"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="DayButtonFocusVisual" Property="Visibility" Value="Visible" />
                            </Trigger>

                            <!-- This DataTrigger is new -->
                            <DataTrigger Value="0">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource SprintCalendarDayConverter}">
                                        <Binding RelativeSource="{RelativeSource AncestorType=Calendar}" Path="DataContext.Sprint"/>
                                        <Binding Path="." />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter TargetName="InSprintDayBackground" Property="Visibility" Value="Hidden" />
                            </DataTrigger>
                            <DataTrigger Value="1">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource SprintCalendarDayConverter}">
                                        <Binding RelativeSource="{RelativeSource AncestorType=Calendar}" Path="DataContext.Sprint"/>
                                        <Binding Path="." />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter TargetName="InSprintDayBackground" Property="CornerRadius" Value="5,0,0,5" />
                                <Setter TargetName="InSprintDayBackground" Property="BorderThickness" Value="1,1,0,1" />
                            </DataTrigger>
                            <DataTrigger Value="3">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource SprintCalendarDayConverter}">
                                        <Binding RelativeSource="{RelativeSource AncestorType=Calendar}" Path="DataContext.Sprint"/>
                                        <Binding Path="." />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter TargetName="InSprintDayBackground" Property="CornerRadius" Value="0,5,5,0" />
                                <Setter TargetName="InSprintDayBackground" Property="BorderThickness" Value="0,1,1,1" />
                            </DataTrigger>

                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="SprintDatePicker" TargetType="{x:Type Calendar}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Calendar}">
                        <Grid>
                            <ToggleButton x:Name="openButton">
                                <ToggleButton.Template>
                                    <ControlTemplate>
                                        <TextBlock
                                            Cursor="Hand" Foreground="Gray"
                                            FontSize="{StaticResource SmallFontSize}"
                                            Text="{Binding ElementName=calendar, Path=SelectedDate, StringFormat='{}{0:d MMM}'}">
                                            <TextBlock.Style>
                                                <Style>
                                                    <Style.Triggers>
                                                        <Trigger Property="TextBlock.IsMouseOver" Value="True">
                                                            <Setter Property="TextBlock.TextDecorations" Value="underline"/>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBlock.Style>
                                        </TextBlock>

                                    </ControlTemplate>
                                </ToggleButton.Template>
                            </ToggleButton>
                            <Popup x:Name="popup" AllowsTransparency="True" IsOpen="{Binding ElementName=openButton, Path=IsChecked}">
                                <Calendar x:Name="calendar"                                  
                                          CalendarDayButtonStyle="{StaticResource SprintDayButtonStyle}"              
                                          SelectedDate="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=SelectedDate}"
                                          DisplayDate="{TemplateBinding DisplayDate}"
                                          DisplayDateStart="{TemplateBinding DisplayDateStart}"
                                          DisplayDateEnd="{TemplateBinding DisplayDateEnd}">
                                    <Calendar.Triggers>
                                        <EventTrigger RoutedEvent="Calendar.SelectedDatesChanged">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames 
                                                                        Storyboard.TargetName="openButton"
                                                                        Storyboard.TargetProperty="IsChecked">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <system:Boolean>False</system:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="Calendar.MouseLeave">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames 
                                                                        Storyboard.TargetName="openButton"
                                                                        Storyboard.TargetProperty="IsChecked">
                                                            <DiscreteObjectKeyFrame KeyTime="00:00:01">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <system:Boolean>False</system:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                    </Calendar.Triggers>
                                </Calendar>
                            </Popup>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <Style x:Key="SprintHeaderBorder" TargetType="{x:Type Border}">
            <Setter Property="Border.CornerRadius" Value="5"/>
            <Setter Property="Border.BorderThickness" Value="2"/>
            <Setter Property="Border.Padding" Value="3"/>
            <Setter Property="Border.Width" Value="120"/>
            <Setter Property="Border.Height" Value="80"/>
            <Setter Property="Border.Background" Value="White"/>
            <Setter Property="Border.BorderBrush">
                <Setter.Value>
                    <SolidColorBrush Color="{StaticResource Green3Color}"/>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="SprintHeaderExpander" TargetType="{x:Type Expander}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">                        
                        <StackPanel Orientation="Horizontal">                                                           
                        <ContentPresenter x:Name="Content"/>
                        <ToggleButton                                     
                                MinWidth="8"
                                VerticalAlignment="Top"
                                Height="85"
                                IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                            <ToggleButton.Template>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <Grid Background="Transparent" Cursor="Hand">                                            
                                        <Polygon   
                                            VerticalAlignment="Top" HorizontalAlignment="Center"
                                            Margin="0,3,0,0"
                                            x:Name="arrow1"
                                            Points="0,5 5,0 5,10">
                                            <Polygon.Fill>
                                                <SolidColorBrush Color="{StaticResource Green3Color}"/>
                                            </Polygon.Fill>
                                        </Polygon>
                                        <Border
                                            x:Name="border"
                                            VerticalAlignment="Top" HorizontalAlignment="Center"
                                            Width="10"
                                            Margin="0,0,2,0"
                                            Style="{StaticResource SprintHeaderBorder}"/>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter TargetName="border" Property="Visibility" Value="Collapsed"/>                                               
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                        <Trigger Property="IsChecked" Value="False">
                                            <Setter TargetName="border" Property="Visibility" Value="Visible"/>                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Collapsed"/>
                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="True">                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="False">                                                
                                            <Setter TargetName="arrow1" Property="Visibility" Value="Collapsed"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </ToggleButton.Template>
                            <ToggleButton.Style>
                                <Style>
                                    <Style.Triggers>
                                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                                            <Setter Property="ToggleButton.IsTabStop" Value="False"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Local"/>
                                        </Trigger>
                                        <Trigger Property="ToggleButton.IsChecked" Value="False">
                                            <Setter Property="ToggleButton.IsTabStop" Value="True"/>
                                            <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="None"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </ToggleButton.Style>

                        </ToggleButton>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="True">
                            <Setter TargetName="Content" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsExpanded" Value="False">
                            <Setter TargetName="Content" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
        

        <DataTemplate x:Key="BacklogItemDataTemplate">

            <Grid>
                <Rectangle x:Name="Rectangle" 
                           RadiusX="5" RadiusY="5"                           
                           Fill="Transparent"
                           Margin="0,3,0,0"
                           Stroke="{StaticResource LabelBrush}"
                           StrokeDashCap="Square" StrokeThickness="2" SnapsToDevicePixels="True" StrokeDashArray="3"/>                    
                
                <SF_Adorners:SurroundBorderAdorner
                    AdornerLayerElement="{Binding ElementName=sprintPlansListBox}"
                    x:Name="itemBorder"
                    Cursor="Hand"                                         
                    Width="115"                  
                    Margin="0,3,0,0"                   
                    ToolTipService.InitialShowDelay="3000"
                    ToolTipService.BetweenShowDelay="3000"
                    ToolTipService.Placement="Bottom"
                    Height="{Binding ItemTotalHoursInPixels}"
                    CornerRadius="5" BorderThickness="2" BorderBrush="Transparent">
                    <SF_Adorners:SurroundBorderAdorner.LeftControl>
                        <Border DataContext="{Binding ElementName=itemBorder, Path=DataContext}" Background="Transparent" Margin="0,0,-10,0" MinHeight="32">
                            <Button
                                Width="32" Height="32"
                                Style="{StaticResource MoveItemLeftButton}"
                                VerticalAlignment="Center"           
                                IsEnabled="{Binding CanMoveItemToPreviousSprint}"
                                Command="{Binding MoveItemToPreviousSprintCommand}" />
                        </Border>
                    </SF_Adorners:SurroundBorderAdorner.LeftControl>
                    <SF_Adorners:SurroundBorderAdorner.RightControl>
                        <Border DataContext="{Binding ElementName=itemBorder, Path=DataContext}" Background="Transparent" Margin="-10,0,0,0" MinHeight="32">
                            <Button
                                Width="32" Height="32"
                                Style="{StaticResource MoveItemRightButton}"
                                VerticalAlignment="Center"                       
                                IsEnabled="{Binding CanMoveItemToNextSprint}"
                                Command="{Binding MoveItemToNextSprintCommand}"/>
                                
                        </Border>
                    </SF_Adorners:SurroundBorderAdorner.RightControl>
                    <SF_Adorners:SurroundBorderAdorner.ToolTip>
                        <TextBlock>                            
                            <Run Text="{Binding Item.BacklogItemNumber, StringFormat='{}[{0}]'}"/>
                            <Run Text="{Binding Item.Name}"/>               
                            <LineBreak/>
                            <TextBlock Text="{Binding Item.TotalHours, StringFormat={x:Static props:Resources.N_hrs}}"/>
                        </TextBlock>
                    </SF_Adorners:SurroundBorderAdorner.ToolTip>
                    <DockPanel Margin="0">
                            <TextBlock DockPanel.Dock="Top"                                       
                                       FontSize="{StaticResource SmallFontSize}"                                       
                                       TextWrapping="Wrap"
                                       LineStackingStrategy="BlockLineHeight"
                                        TextTrimming="CharacterEllipsis">
                                <Image                                    
                                    DataContext="{Binding Item.Status}"                                                                   
                                    Style="{StaticResource BacklogItemStatusImage}" Width="16" Height="16" Stretch="Uniform" />
                                <Run Foreground="{StaticResource LabelBrush}" FontSize="{StaticResource SmallFontSize}" Text="{Binding Item.Name}" BaselineAlignment="TextTop"/>    
                            </TextBlock>
                        
                            <TextBlock
                            DockPanel.Dock="Bottom"
                            HorizontalAlignment="Right" VerticalAlignment="Bottom"
                            FontSize="{StaticResource TinyFontSize}"                            
                                Foreground="{StaticResource SubTextBrush}"
                                
                            Text="{Binding Item.CurrentTotalHours, StringFormat={x:Static props:Resources.N_hrs}}"/>
                            <DockPanel.Style>
                                <Style>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ItemTotalHoursInPixels}" Value="16">
                                            <Setter Property="DockPanel.Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </DockPanel.Style>
                        </DockPanel>
                    <SF_Adorners:SurroundBorderAdorner.Style>
                        <Style>
                            <Setter Property="Border.Background" Value="#EEEEEE"/>                                
                            <Style.Triggers>
                                <Trigger Property="Border.IsMouseOver" Value="True">
                                    <Setter Property="Border.Background">
                                        <Setter.Value>
                                            <SolidColorBrush Color="{StaticResource Green1Color}"/>
                                        </Setter.Value>
                                    </Setter>                                    
                                    <Setter Property="TextBlock.Foreground">
                                        <Setter.Value>
                                            <SolidColorBrush Color="{StaticResource Green3Color}"/>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </SF_Adorners:SurroundBorderAdorner.Style>

                </SF_Adorners:SurroundBorderAdorner>

            </Grid>
          

            
        </DataTemplate>

    </UserControl.Resources>
    
        <Grid HorizontalAlignment="Stretch">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <ToolBar Grid.Row="0">
                <MenuItem Header="{x:Static props:Resources.Add_sprint}" Command="{Binding CreateNewSprintCommand}">
                    <MenuItem.Icon>
                    <Image Source="/Images/ToolBar/Add.png" Width="32" Height="32" Stretch="Uniform"/>
                    </MenuItem.Icon>
                </MenuItem>                
            </ToolBar>

        <StackPanel Grid.Row="1" Orientation="Horizontal">

            <StackPanel Orientation="Vertical" Margin="0,0,6,0">
                <Border Style="{StaticResource SprintHeaderBorder}">                        
                    <TextBlock 
                                    Foreground="{StaticResource TitleTextBrush}"
                                    FontWeight="Bold"
                                    TextWrapping="Wrap"
                                    Text="{x:Static props:Resources.Previous_sprint_items}"/>                            
                </Border>
                <ListBox
                    x:Name="notFinishedItemsListBox"
                    BorderThickness="0"
                    Background="Transparent"                    
                    ItemContainerStyle="{StaticResource NoHoverListBoxItem}"
                    ItemTemplate="{StaticResource BacklogItemDataTemplate}"
                    ItemsSource="{Binding NotFinishedItems}"/>
                
                <StackPanel.Style>
                    <Style>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=notFinishedItemsListBox, Path=HasItems}" Value="False">
                                <Setter Property="StackPanel.Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                    

            </StackPanel>

            <ListBox            
                x:Name="sprintPlansListBox"
                Background="Transparent"                
                ItemContainerStyle="{StaticResource NoHoverListBoxItem}"
                BorderThickness="0"                                
                ItemsSource="{Binding SprintPlans}">                
                
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Expander IsExpanded="True" Style="{StaticResource SprintHeaderExpander}" >
                            <StackPanel Orientation="Vertical">
                                <Border Style="{StaticResource SprintHeaderBorder}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="auto" />
                                            <RowDefinition Height="auto"/>
                                            <RowDefinition Height="auto"/>
                                            <RowDefinition Height="auto"/>
                                        </Grid.RowDefinitions>
                                        <TextBlock
                                            Grid.Row="0" Grid.Column="0"                                            
                                           Foreground="{StaticResource TitleTextBrush}"
                                           FontWeight="Bold" FontSize="{StaticResource BigFontSize}"
                                           Text="{Binding Sprint.SprintNumber, StringFormat={x:Static props:Resources.Sprint_N}}"/>
                                        <Calendar
                                            Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left"
                                            DisplayDate="{Binding Sprint.StartDate, Mode=OneTime}"
                                            
                                            SelectedDate="{Binding SprintStartDate, UpdateSourceTrigger=PropertyChanged}"                                            
                                            Style="{StaticResource SprintDatePicker}"/>
                                        <Calendar
                                            Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right"
                                            DisplayDate="{Binding Sprint.StartDate, Mode=OneTime}"
                                            DisplayDateStart="{Binding Sprint.StartDate, Mode=OneTime}"
                                            SelectedDate="{Binding SprintEndDate, UpdateSourceTrigger=PropertyChanged}"                                            
                                            Style="{StaticResource SprintDatePicker}"/>
                                        <TextBlock 
                                            Grid.Row="2" Grid.ColumnSpan="2"
                                            FontStyle="Italic"
                                           Foreground="{StaticResource TitleTextBrush}">
                                            <TextBlock Text="{Binding TotalHours, Mode=OneWay, StringFormat={x:Static props:Resources.N_hrs}}"/><Run Text=","/>
                                            <Run Text="{Binding Sprint.WorkDayCount, Mode=OneWay, StringFormat={x:Static props:Resources.N_days}}"/>
                                        </TextBlock>

                                        <Image                                                                          
                                            Grid.Row="3" Grid.ColumnSpan="2"
                                            Source="/Images/Toolbar/teamMemberMeter.png"
                                            Stretch="None"                                            
                                            Height="16" HorizontalAlignment="Left" MaxWidth="128"
                                            Width="{Binding NumberOfMembersNeededForDoItInPixels}">
                                            <Image.ToolTip>
                                                <TextBlock Text="{Binding NumberOfMembersNeededForDoIt, StringFormat={x:Static props:Resources.You_will_need_N_guys_to_perform_this_sprint}}" />
                                            </Image.ToolTip>
                                        </Image>
                                            

                                    </Grid>
                                    
                                </Border>

                                <ListBox
                                    BorderThickness="0"                                    
                                    Background="Transparent"                                    
                                    ItemContainerStyle="{StaticResource NoHoverListBoxItem}"
                                    ItemTemplate="{StaticResource BacklogItemDataTemplate}"
                                    ItemsSource="{Binding PlannedItems}"/>
                                    
                            </StackPanel>
                            
                        </Expander>
                        
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>

            
        </StackPanel>

            
            
    </Grid>
</UserControl>
